package com.yjha.ai.demos.web.service.impl;

import com.yjha.ai.demos.web.entity.Recording;
import com.yjha.ai.demos.web.mapper.RecordingMapper;
import com.yjha.ai.demos.web.service.RecordingService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class RecordingServiceImpl  implements RecordingService {

    @Resource
    private RecordingMapper recordingMapper;

    @Override
    public void save(Recording recording) {
        recordingMapper.save(recording);
    }

    @Override
    public Map<String, Object> getHistory(Integer id) {
        Map<String, Object> stringObjectHashMap = new HashMap<>();

        Recording historyById = recordingMapper.getHistoryById(id);

        stringObjectHashMap.put("data",historyById.getData());

        stringObjectHashMap.put("display_type",historyById.getDisplayType());

        return stringObjectHashMap;
    }
}
